package com.newenergy.wisehome.ui.fragment;

import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.newenergy.wisehome.R;
import com.newenergy.wisehome.common.helper.SPUtil;
import com.newenergy.wisehome.config.Constants;

import butterknife.BindView;
import butterknife.OnClick;
import me.yokeyword.fragmentation.ISupportFragment;

/**
 * Created by kyx on 2018/8/14.
 */

public class WelcomeFragment extends BaseFragment {


    @BindView(R.id.btn_check)
    Button mBtnCheck;
    @BindView(R.id.tv_ignore_tips)
    TextView mTvIgnoreTips;
    @BindView(R.id.btn_confirm)
    Button mBtnConfirm;

    private boolean isCheck = false;

    @Override
    public int getLayoutId() {
        return R.layout.welcome_fragment;
    }

    @Override
    public void init(View rootView) {

    }


    public static ISupportFragment newInstance() {
        return new WelcomeFragment();
    }



    @OnClick({R.id.btn_check, R.id.btn_confirm})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.btn_check:
                isCheck = !isCheck;
                if (isCheck) {
                    mBtnCheck.setBackgroundResource(R.drawable.btn_checked);
                }else {
                    mBtnCheck.setBackgroundResource(R.drawable.btn_uncheck);
                }

                break;
            case R.id.btn_confirm:
                if (isCheck){
                    SPUtil.put(Constants.NEVERREMIND,true);
                }
                start(MainFragment.newInstance());

                break;
        }
    }
}
